<template>
  <div class="company-library-box" v-if="list.length">
    <div class="title">
      企业库
      <div class="more-btn" @click="onDetail">更多</div>
    </div>
    <div class="company-box">
      <el-row :gutter="10">
        <el-col :span="8" v-for="(item, index) of list" :key="index">
          <div class="item-img" @click="onDetail" :style="{backgroundImage: 'url(' + item.coverUrl + ')'}"></div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
import { sideModuleRecommends } from '@/api/api';

export default {
  data() {
    return {
      list: []
    }
  },
  mounted() {
    this.getList();
  },
  methods: {
    // 获取企业库列表
    async getList() {
      const params = {
        moduleId: 4,
        status: 1,
        resType: 'QY',
        start:0,
        limit:6
      };
      const res = await sideModuleRecommends(params);
      this.list = res.list || [];
    },
    onDetail() {
      let routerJump = this.$router.resolve({ name: 'Companylibrary' });
      window.open(routerJump.href, '_blank');
    }
  }
}
</script>

<style lang="scss" scoped>
.company-library-box {
  margin-bottom: 36px;
  .title {
    height: 32px;
    font-size: 24px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #272727;
    line-height: 32px;
    margin-bottom: 24px;
    .more-btn {
      height: 18px;
      font-size: 14px;
      
      font-weight: 400;
      color: #696969;
      line-height: 18px;
      float: right;
      margin-top: 7px;
      cursor: pointer;
    }
  }
  .company-box {
    cursor: pointer;
    .item-img {
      width: 6.62rem;
      height: 6.62rem;
      border-radius: 4px;
      margin: 8px 0px;
      background-repeat: no-repeat;
      background-size: 100% 100%;
    }
  }
}
</style>